package com.example.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.admin.bean.Account;
import com.example.admin.mapper.AccountMapper;
import com.example.admin.service.AccountService;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements AccountService {

    @Autowired
    AccountMapper accountMapper;

    Counter counter;

    public AccountServiceImpl(MeterRegistry meterRegistry){
        counter = meterRegistry.counter("accountService.saveAccount.counter");
    }

    public void saveAccount(Account account){
        counter.increment();
        accountMapper.insert(account);
    }

}
